<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<DiscMaster.Web.Models.Match>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	DiscMaster | Matches
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h1>Upcoming matches</h1>
    <% if (Model.Where(m=>m.matchdate>DateTime.Now).Count()==0)
       {
    %>
        <p>No upcoming matches registered..</p>
    <%
       }
       else
       {
    %>
        <table width="600">
            <tr>
                <th>
                    matchdate
                </th>
                <th>
                    match
                </th>
                <th>
                    course
                </th>
                <th>
                    created by
                </th>
            </tr>
        <% foreach (var item in Model.Where(m=>m.matchdate>DateTime.Now)) { %>
            <% Html.RenderPartial("~/Areas/Matches/Views/Matches/DisplayTemplates/Match.ascx", item); %>
        <% } %>
        </table>
    <%
       }%>
    
    <h1>Past matches</h1>
    <% if (Model.Where(m=>m.matchdate<DateTime.Now).Count()==0)
       {
    %>
        <p>No past matches registered..</p>
    <%
       }
       else
       {
    %>
        <table width="600">
            <tr>
                <th>
                    matchdate
                </th>
                <th>
                    match
                </th>
                <th>
                    course
                </th>
                <th>
                    created by
                </th>
            </tr>
        <% foreach (var item in Model.Where(m=>m.matchdate<DateTime.Now)) { %>
        <% Html.RenderPartial("~/Areas/Matches/Views/Matches/DisplayTemplates/Match.ascx", item); %>
        <% } %>

        </table>        
    <%
       }%>
<br /><br />
    <div style="padding-top: 4px; clear: both;">
            <img alt="add" src="/Image.ashx?src=/Content/Media/Icons/24x24/add.png&width=18" style="vertical-align: middle;" />
            &nbsp;
            <%= Html.ActionLink("Register new match", "Create") %>
        </div>

</asp:Content>

